{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "!mkdir train\n",
    "!mkdir test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "\n",
    "with open('dataset.json') as fopen:\n",
    "    data = json.load(fopen)\n",
    "    \n",
    "train_X = data['train_X']\n",
    "train_Y = data['train_Y']\n",
    "test_X = data['test_X']\n",
    "test_Y = data['test_Y']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('train/before.txt', 'w') as fopen:\n",
    "    fopen.write('\\n'.join(train_X))\n",
    "    \n",
    "with open('train/after.txt', 'w') as fopen:\n",
    "    fopen.write('\\n'.join(train_Y))\n",
    "    \n",
    "with open('test/before.txt', 'w') as fopen:\n",
    "    fopen.write('\\n'.join(test_X))\n",
    "    \n",
    "with open('test/after.txt', 'w') as fopen:\n",
    "    fopen.write('\\n'.join(test_Y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train/\n",
      "train/after.txt\n",
      "train/before.txt\n",
      "test/\n",
      "test/after.txt\n",
      "test/before.txt\n"
     ]
    }
   ],
   "source": [
    "!tar -czvf train-translation.tar.gz train\n",
    "!tar -czvf test-translation.tar.gz test"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
